<script type="text/javascript">
	function selAddress(id){
		document.getElementById("braId").value = id;
		theForm.submit();
	}
	
	function checkConsignee(obj){
		//获取隐藏域中的收货地址id
		braId = $("#braId").val();
		braConsignee = $("#braConsignee").val();
		braCountry = $("#braCountry").val();
		braProvince = $("#braProvince").val();
		braCity = $("#braCity").val();
		braDistrict = $("#braDistrict").val();
		braDetail = $("#braDetail").val();
		braZipcode = $("#braZipcode").val();
		braMobile = $("#braMobile").val();
		braPhone = $("#braPhone").val();
		braTime = $("#braTime").val();
		// 检查输入
		var msg = "";
		
		if (Utils.isEmpty(braConsignee)) {
			msg += Pmt.warn_consignee_blank + '\n';
		}
		
		if(braCountry == "0" || braProvince == "0" || braCity == "0" || braDistrict == "0"){
			msg += Pmt.warn_unselect_region + '\n';
		}
		
		if (Utils.isEmpty(braDetail)) {
			msg += Pmt.warn_addr_detail_blank + '\n';
		}
		
		if (Utils.isEmpty(braMobile)) {
			msg += Pmt.warn_mobile_blank + '\n';
		} else if (!Utils.isMobile(braMobile)) {
			msg += Pmt.warn_mobile_invalid + '\n';
		}
		
		if (!Utils.isEmpty(msg)) {
			alert(msg);
			return false;
		}
	}
</script>
<div class="block">
	<form action="${var_contextpath}/order/orderDetail.xhtml" method="post"
		name="theForm" id="theForm" onsubmit="return checkConsignee(this)">
		<input id="braId" name="braId" type="hidden" class="inputBg" value="" />	
		[#-- 读取用户地址列表标签 --]
		[@ecs_userAddrList par_memberid = var_memberid] 
			[#if var_userAddrList??]
			<h6>
				<span>选择收货地址</span>
			</h6>
			<table align="center" class="buy_tab_addr">
				<tr>
					<td align="center">
						收货人
					</td>
					<td align="center">
						所在区域
					</td>
					<td align="center">
						详细地址
					</td>
					<td align="center">
						座机/手机
					</td>
					<td align="center">
						邮编
					</td>
					<td align="center">
						操作
					</td>
				</tr>
				[#list var_userAddrList as data ]
					<tr>
						<td align="center">
							${data.braConsignee}
						</td>
						<td align="center">
							[#-- 读取配送区域自定义标签。参数说明：par_disRegionId（配送区域ID）--]
						    [@ecs_disRegionInfo par_disRegionId = data.braCountry ]
						    	${(var_disRegionInfo.bdrName)! ""}
						    [/@ecs_disRegionInfo]
						    
						    [#-- 读取配送区域自定义标签。参数说明：par_disRegionId（配送区域ID）--]
						    [@ecs_disRegionInfo par_disRegionId = data.braProvince ]
						    	${(var_disRegionInfo.bdrName)! ""}
						    [/@ecs_disRegionInfo]
						    
						    [#-- 读取配送区域自定义标签。参数说明：par_disRegionId（配送区域ID）--]
						    [@ecs_disRegionInfo par_disRegionId = data.braCity ]
						    	${(var_disRegionInfo.bdrName)! ""}
						    [/@ecs_disRegionInfo]
						    
						    [#-- 读取配送区域自定义标签。参数说明：par_disRegionId（配送区域ID）--]
						    [@ecs_disRegionInfo par_disRegionId = data.braDistrict ]
						    	${(var_disRegionInfo.bdrName)! ""}
						    [/@ecs_disRegionInfo]
						</td>
						<td align="center">
							${data.braDetail}
						</td>
						<td align="center">
							[#if (data.braPhone) ?? && (data.braPhone) != ""]
								${data.braPhone}/${(data.braMobile)! ""}
							[#else]
								${(data.braMobile)! ""}
							[/#if]
						</td>
						<td align="center">
							${data.braZipcode}
						</td>
						<td align="center">
							<a href="javascript:selAddress('${data.braId}')">配送至这个地址</a>
						</td>
					</tr>
				[/#list]	
			</table>
			<div class="blank5"></div>
			<div class="blank5"></div>
			[/#if]
		[/@ecs_userAddrList]	
		<div class="flowBox">	
			<h6>
				<span>填写收货地址</span>
			</h6>
			<table width="99%" align="center" border="0" cellpadding="5"
				cellspacing="1" bgcolor="#dddddd">
				<tr>
					<td bgcolor="#ffffff">
						配送区域:
					</td>
					<td colspan="3" bgcolor="#ffffff">
						[#-- 读取区域列表自定义标签--]
						[@ecs_countrylist]
							[@ecs_ud_countryList par_bdrList_country = var_bdrList_country /]
							[@ecs_ud_provinceList /]
							[@ecs_ud_cityList /]
							[@ecs_ud_districtList /]
			          	[/@ecs_countrylist]
						(必填)
					</td>
				</tr>
				<tr>
					<td bgcolor="#ffffff">
						收 货 人:
					</td>
					<td bgcolor="#ffffff">
						<input name="braConsignee" type="text" class="inputBg"
							id="braConsignee" value="" />
						(必填)
					</td>
					<td bgcolor="#ffffff">
						收货时间:
					</td>
					<td bgcolor="#ffffff">
						<input name="braTime" type="text" class="inputBg"
							id="braTime" value="" />
					</td>
				</tr>
				<tr>
					<td bgcolor="#ffffff">
						详细地址:
					</td>
					<td bgcolor="#ffffff">
						<input name="braDetail" type="text" class="inputBg" id="braDetail"
							value="" />
						(必填)
					</td>
					<td bgcolor="#ffffff">
						邮政编码:
					</td>
					<td bgcolor="#ffffff">
						<input name="braZipcode" type="text" class="inputBg" id="braZipcode"
							value="" />
					</td>
				</tr>
				<tr>
					<td bgcolor="#ffffff">
						手&nbsp;&nbsp;&nbsp;&nbsp;机:
					</td>
					<td bgcolor="#ffffff">
						<input name="braMobile" type="text" class="inputBg" id="braMobile"
							value="" />
						(必填)
					</td>
					<td bgcolor="#ffffff">
						电&nbsp;&nbsp;&nbsp;&nbsp;话:
					</td>
					<td bgcolor="#ffffff">
						<input name="braPhone" type="text" class="inputBg" id="braPhone" value="" />
					</td>
				</tr>
				<tr>
					<td colspan="4" align="center" bgcolor="#ffffff">
						<input type="submit" name="Submit" class="bnt_blue_2"
							value="配送至这个地址" />
					</td>
				</tr>
			</table>
		</div>
	</form>
</div>